package com.aaa.mrcai.controller;

import com.aaa.mrcai.annotion.AAALog;
import com.aaa.mrcai.pojo.vo.GoodsCompanyVo;
import com.aaa.mrcai.query.GoodsCompanyQuery;
import com.aaa.mrcai.result.AjaxResult;
import com.aaa.mrcai.service.GoodsCompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Demo class
 *
 * @Author: Wang
 * @Date: Created in 19:43 2021/12/6
 */
@RestController
@RequestMapping("goodsCompany")
public class GoodsCompanyController {
    @Autowired
    public GoodsCompanyService goodsCompanyService;

    @RequestMapping("list")
    public AjaxResult list(GoodsCompanyQuery query){
        return goodsCompanyService.list(query);
    }

    @RequestMapping("addGoodsCompany")
    @AAALog("添加商品类型")
    public AjaxResult addGoodsCompany (GoodsCompanyVo goodsCompanyVo){
        return goodsCompanyService.addGoodsCompany(goodsCompanyVo);
    }

    @RequestMapping("/getGoodsCompany/{id}")
    public AjaxResult getGoodsCompany (@PathVariable("id") int id ){
        return goodsCompanyService.getGoodsCompany(id);
    }

    @RequestMapping("updateGoodsCompany")
    @AAALog("修改商品类型")
    public AjaxResult updateGoodsCompany (GoodsCompanyVo goodsCompanyVo){
        return goodsCompanyService.updateGoodsCompany(goodsCompanyVo);
    }

    @RequestMapping("/deleteGoodsCompany/{id}")
    @AAALog("删除商品类型")
    public AjaxResult deleteGoodsCompany (@PathVariable("id") int id ){ return goodsCompanyService.deleteGoodsCompany(id); }

}
